home *** CD-ROM | disk | FTP | other *** search
-
-
-
- HHHHaaaannnnddddlllleeeessss((((3333TTTTccccllll)))) HHHHaaaannnnddddlllleeeessss((((3333TTTTccccllll))))
-
-
-
- NNNNAAAAMMMMEEEE
- Tcl_HandleAlloc, Tcl_HandleFree, Tcl_HandleTblInit, Tcl_HandleTblRelease,
- Tcl_HandleTblUseCount Tcl_HandleWalk, Tcl_HandleXlate - Dynamic, handle
- addressable tables.
-
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- #include <tclExtend.h>
-
- void_pt
- Tcl_HandleTblInit (const char *handleBase,
- int entrySize,
- int initEntries);
-
- int
- Tcl_HandleTblUseCount (void_pt headerPtr,
- int amount);
-
- void
- Tcl_HandleTblRelease (void_pt headerPtr);
-
- void_pt
- Tcl_HandleAlloc (void_pt headerPtr,
- char *handlePtr);
-
- void_pt
- Tcl_HandleXlate (Tcl_Interp *interp,
- void_pt headerPtr,
- const char *handle);
-
- void_pt
- Tcl_HandleWalk (void_pt headerPtr,
- int *walkKeyPtr);
-
- void
- Tcl_WalkKeyToHandle (void_pt headerPtr,
- int walkKey,
- char *handlePtr);
-
- void
- Tcl_HandleFree (void_pt headerPtr,
- void_pt entryPtr);
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- The Tcl handle facility provides a way to manage table entries that may
- be referenced by a textual handle from Tcl code. This is provided for
- applications that need to create data structures in one command, return a
- reference (i.e. pointer) to that particular data structure and then
- access that data structure in other commands. An example application is
- file handles.
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- HHHHaaaannnnddddlllleeeessss((((3333TTTTccccllll)))) HHHHaaaannnnddddlllleeeessss((((3333TTTTccccllll))))
-
-
-
- A handle consists of a base name, which is some unique, meaningful name,
- such as `ffffiiiilllleeee' and a numeric value appended to the base name (e.g.
- `file3'). The handle facility is designed to provide a standard
- mechanism for building Tcl commands that allocate and access table
- entries based on an entry index. The tables are expanded when needed,
- consequently pointers to entries should not be kept, as they will become
- invalid when the table is expanded. If the table entries are large or
- pointers must be kept to the entries, then the the entries should be
- allocated separately and pointers kept in the handle table. A use count
- is kept on the table. This use count is intended to determine when a
- table shared by multiple commands is to be release.
-
- TTTTccccllll____HHHHaaaannnnddddlllleeeeTTTTbbbbllllIIIInnnniiiitttt
- Create and initialize a Tcl dynamic handle table. The use count on the
- table is set to one.
-
- Parameters:
- oooo _h_a_n_d_l_e_B_a_s_e - The base name of the handle, the handle will be returned
- in the form "baseNN", where NN is the table entry number.
- oooo _e_n_t_r_y_S_i_z_e - The size of an entry, in bytes.
- oooo _i_n_i_t_E_n_t_r_i_e_s - Initial size of the table, in entries.
-
- Returns:
- A pointer to the table header.
-
- TTTTccccllll____HHHHaaaannnnddddlllleeeeTTTTbbbbllllUUUUsssseeeeCCCCoooouuuunnnntttt
- Alter the handle table use count by the specified amount, which can be
- positive or negative. Amount may be zero to retrieve the use count.
-
- Parameters:
- oooo _h_e_a_d_e_r_P_t_r - Pointer to the table header.
- oooo _a_m_o_u_n_t - The amount to alter the use count by.
-
- Returns:
- The resulting use count.
-
- TTTTccccllll____HHHHaaaannnnddddlllleeeeTTTTbbbbllllRRRReeeelllleeeeaaaasssseeee
- Decrement the use count on a Tcl dynamic handle table. If the count goes
- to zero or negative, then release the table.
-
- Parameters:
- oooo _h_e_a_d_e_r_P_t_r - Pointer to the table header.
-
- TTTTccccllll____HHHHaaaannnnddddlllleeeeAAAAlllllllloooocccc
- Allocate an entry and associate a handle with it.
-
- Parameters:
- oooo _h_e_a_d_e_r_P_t_r - A pointer to the table header.
- oooo _h_a_n_d_l_e_P_t_r - Buffer to return handle in. It must be big enough to hold
- the name.
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- HHHHaaaannnnddddlllleeeessss((((3333TTTTccccllll)))) HHHHaaaannnnddddlllleeeessss((((3333TTTTccccllll))))
-
-
-
- Returns:
- A pointer to the allocated entry (user part).
-
- TTTTccccllll____HHHHaaaannnnddddlllleeeeXXXXllllaaaatttteeee
- Translate a handle to a entry pointer.
-
- Parameters:
- oooo _i_n_t_e_r_p - A error message may be returned in result.
- oooo _h_e_a_d_e_r_P_t_r - A pointer to the table header.
-
- o _h_a_n_d_l_e - The handle assigned to the entry.
-
- Returns:
- A pointer to the entry, or NULL if an error occured.
-
- TTTTccccllll____HHHHaaaannnnddddlllleeeeWWWWaaaallllkkkk
- Walk through and find every allocated entry in a table. Entries may be
- deallocated during a walk, but should not be allocated.
-
- Parameters:
- oooo _h_e_a_d_e_r_P_t_r - A pointer to the table header.
- oooo _w_a_l_k_K_e_y_P_t_r - Pointer to a variable to use to keep track of the place
- in the table. The variable should be initialized to -1 before the
- first call.
- Returns:
- A pointer to the next allocated entry, or NULL if there are not more.
-
- TTTTccccllll____WWWWaaaallllkkkkKKKKeeeeyyyyTTTTooooHHHHaaaannnnddddlllleeee
- Convert a walk key, as returned from a call to Tcl_HandleWalk into a
- handle. The Tcl_HandleWalk must have succeeded.
-
- Parameters:
- oooo _h_e_a_d_e_r_P_t_r - A pointer to the table header.
- oooo _w_a_l_k_K_e_y - The walk key.
- oooo _h_a_n_d_l_e_P_t_r - Buffer to return handle in. It must be big enough to hold
- the name.
-
- TTTTccccllll____HHHHaaaannnnddddlllleeeeFFFFrrrreeeeeeee
- Frees a handle table entry.
-
- Parameters:
- oooo _h_e_a_d_e_r_P_t_r - A pointer to the table header.
- oooo _e_n_t_r_y_P_t_r - Entry to free.
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-